﻿using Common.Prism.Apps;
using NxChatQQ.Models;
using NxChatQQ.Models.Events;
using Prism.Events;
using Prism.Regions;
using System;
using System.Collections.ObjectModel;

namespace NxChatQQ.ViewModels.Layouts
{
    public class CollectContentLayoutViewModel : BaseViewModel
    {

        private string _NameTitle = "全部";
        public string NameTitle
        {
            get { return _NameTitle; }
            set { SetProperty(ref _NameTitle, value); }
        }

        public ObservableCollection<CollectModel> CollectList { get; set; }

        public CollectContentLayoutViewModel(IEventAggregator eventAggregator, IRegionManager regionManager)
        {

            CollectList = new ObservableCollection<CollectModel>();

            CollectList.Add(new CollectModel()
            {
                FromName = "梨花",
                Content = "WPF NB",
                CollectTime = DateTime.Now,
                CollectType = Models.Enums.kWCMessageType.Text
            });

            CollectList.Add(new CollectModel()
            {
                FromName = "张思思导师组沟通群",
                Content = "WPF NB",
                CollectTime = DateTime.Now,
                CollectType = Models.Enums.kWCMessageType.Text
            });

            CollectList.Add(new CollectModel()
            {
                FromName = "梨花2",
                Content = "WPF NB",
                CollectTime = DateTime.Now,
                CollectType = Models.Enums.kWCMessageType.Text
            });

            CollectList.Add(new CollectModel()
            {
                FromName = "梨花3",
                Content = "WPF NB",
                CollectTime = DateTime.Now,
                CollectType = Models.Enums.kWCMessageType.Text
            });

            GetEvent<UpdateNavtabEvent>().Subscribe(UpdateCollectContent);
        }

        private void UpdateCollectContent(NavtabModel model)
        {
            NameTitle = model.Name;


        }
    }
}
